
<!DOCTYPE html>
<html>
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <meta name="author" content="Alexander Barth">

   <title>matplot: 1D plot</title>
   <link href="style.css" rel="stylesheet" type="text/css" />
   <link href="prettify/prettify.css" type="text/css" rel="stylesheet" />
   <script type="text/javascript" src="prettify/prettify.js"></script>
   <script type="text/javascript" src="numeric-1.2.3.js"></script>
   <link href="../matplot.css" rel="stylesheet" type="text/css" />
   <script type="text/javascript" src="matplot.js"></script>


   <script type="text/javascript">
function init() {      
  
 var i,x=[],y=[],z=[];

 for (i=0; i < 49; i++) {
   x[i] = i+3;
   y[i] = Math.sin(i/5);
   z[i] = Math.sin((i+3)/5);
 }
 
// make a figure of size 700 x 500 pixels
fig = new matplot.Figure("plot",700,500);
ax = fig.axes();

// simple plot using indices as x-axis and values in parameter z as y-axis
// The curve is draw with the given color. The label will be used later in the legend
ax.plot(z,{color: 'red', label: 'foo'});
      
// define marker and marker size
ax.plot(y,{color: 'blue', marker: 'o', markerSize: 5, label: 'bar'});
 
// make a dotted line with linespec
ax.plot(x,y,{color: 'green', marker: 's', linewidth: 2, label: 'baz'});

// add legend
ax.legend();

// add annotation at the location x=20, y=0.6 and z=0 with the given text
ax.annotation(20,0.6,0,'annotation');

// draw everything
fig.draw();

}

addEventListener('load', function (event) { prettyPrint() }, false);

    </script>
 </head>
    <body onload="init()">
    <h1>matplot: 1D plot</h1>
    <p>Simple 1D line plots with different markers, anotation and legend (function plot)</p>
    <div id="plot"></div>
    <h2>Code:</h2>
    <pre class=prettyprint>

 var i,x=[],y=[],z=[];

 for (i=0; i &lt; 49; i++) {
   x[i] = i+3;
   y[i] = Math.sin(i/5);
   z[i] = Math.sin((i+3)/5);
 }
 
// make a figure of size 700 x 500 pixels
fig = new matplot.Figure("plot",700,500);
ax = fig.axes();

// simple plot using indices as x-axis and values in parameter z as y-axis
// The curve is draw with the given color. The label will be used later in the legend
ax.plot(z,{color: 'red', label: 'foo'});
      
// define marker and marker size
ax.plot(y,{color: 'blue', marker: 'o', markerSize: 5, label: 'bar'});
 
// make a dotted line with linespec
ax.plot(x,y,{color: 'green', marker: 's', linewidth: 2, label: 'baz'});

// add legend
ax.legend();

// add annotation at the location x=20, y=0.6 and z=0 with the given text
ax.annotation(20,0.6,0,'annotation');

// draw everything
fig.draw();

    </pre>    
  </body>
</html>
